package com.wgchao.identityrightsmanagement.infrastructure.convert;

import com.wgchao.identityrightsmanagement.domain.resource.model.FunctionResources;
import com.wgchao.identityrightsmanagement.domain.resource.model.MenuResources;
import com.wgchao.identityrightsmanagement.infrastructure.jpa.entity.SysResourceFunction;
import com.wgchao.identityrightsmanagement.infrastructure.jpa.entity.SysResourceMenu;
import com.wgchao.identityrightsmanagement.infrastructure.jpa.repository.SysResourceFunctionRepository;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @ClassName: MenuConvert
 * @author: wgchao
 * @createTime: 2020/6/18 3:14 PM
 * @Description: TODO
 */
@Component
public class MenuConvert {

    public MenuResources convert(SysResourceMenu sysResourceMenu){
        MenuResources menuResources = new MenuResources(sysResourceMenu.getId(), sysResourceMenu.getMenuMark(), sysResourceMenu.getProMark(),
                sysResourceMenu.getMenuName(), sysResourceMenu.getSuperiorMark(), sysResourceMenu.getDescription(),
                sysResourceMenu.getVersion());
        return menuResources;
    }

    public SysResourceMenu convert(MenuResources menuResources){
        SysResourceMenu sysResourceMenu = new SysResourceMenu();
        BeanUtils.copyProperties(menuResources, sysResourceMenu);
        return sysResourceMenu;
    }
}
